package com.hobee.basic.config.rabbit.consumer;

/**
 * @author junjie.li
 * @date 2020/7/22 11:31
 */
public interface ConsumerHandler {
    /**
     * 消费
     *
     * @param target    消费执行类
     * @param content   消息内容
     * @param messageId 消息标识
     * @throws Exception 异常信息
     */
    default void consumer(Class target, String content, String messageId) throws Exception {
        ConsumerHandler consumerHandler = (ConsumerHandler) target.newInstance();
        consumerHandler.consumer(content, messageId);
    }

    /**
     * 消费
     *
     * @param content   content
     * @param messageId 消息标识
     */
    void consumer(String content, String messageId);
}
